/*
https://leetcode.cn/problems/subsets/description/?envType=problem-list-v2&envId=AnEpLQwV
78. 子集
*/

class Solution {
public:
set<vector<int>>se;
vector<vector<int>>ans;

void get(vector<int>& nums,int k,int len,vector<int>& arr)
{
    if(k==len)
    {
        se.insert(arr);
        return ;
    }
    for(int i=k;i<nums.size();i++)
    {
        arr.push_back(nums[i]);
        get(nums,i+1,len,arr);
        arr.pop_back();
        get(nums,i+1,len,arr);
    }
}

    vector<vector<int>> subsets(vector<int>& nums) {
        vector<int>arr;
        int n=nums.size();
        get(nums,0,n,arr);
        for(auto it:se)
        {
            ans.push_back(it);
        }
        return ans;
    }
};
